<?php

namespace App\Http\Requests\Home;

use Illuminate\Foundation\Http\FormRequest;

class AddressRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'linkman' => 'required|max:16',
            'telephone' => 'required|numeric',
            'pro' => 'required',
            'city' => 'required',
            'area' => 'required',
            'dec' => 'required|max:100',
        ];
    }

    public function messages()
    {
        return [
           'linkman.required' => '收货人不能为空',
           'linkman.max' => '收货人名字过长',
           'telephone.required' => '电话号码不能为空',
           'telephone.numeric' => '电话号码只能为数字',
           'pro.required' => '请选择所在地',
           'city.required' => '请选择所在地',
           'area.required' => '请选择所在地',
           'dec.required' => '详细地址不能为空',
           'dec.max' => '请100字以内写出你的详细地址'

        ];
    }
}
